﻿// https://mp.weixin.qq.com/s?__biz=MzUxNjY5NTYxNA==&mid=2247489727&idx=2&sn=0f6ba349e436768476b8403bc3ba268e&scene=21#wechat_redirect
// https://leetcode-cn.com/problems/ransom-note/

#include <iostream>
#include <vector>
#include <string>
#include <unordered_set>
#include <map>
#include <unordered_map>

using namespace std;

// struct ListNode {
//     int val;
//     ListNode *next;
//     ListNode() : val(0), next(nullptr) {}
//     ListNode(int x) : val(x), next(nullptr) {}
//     ListNode(int x, ListNode *next) : val(x), next(next) {}
// };

class Solution {
public:
    bool canConstruct(string ransomNote, string magazine) {
        int letter[26] = {0};
        for (char c : magazine) {
            letter[c - 'a']++;
        }
        for (char c : ransomNote) {
            if (letter[c - 'a']-- == 0)
                return false;   
        }
        return true;
    }
};

int main() {
    Solution obj = Solution();
}